<template>
	<view class="group-buy">
		<!-- 紫色弧线背景 -->
		<svg class="arc-svg" viewBox="0 0 100 30" preserveAspectRatio="none">
			<path 
				d="M0 0 V20 Q50 30 100 20 V0 Z" 
				fill="#7501E2" 
			/>
		</svg>
		
		<!-- 顶部促销横幅图片 -->
		<view class="promo-banner">
			<image 
				class="banner-image" 
				src="/static/groupBuy/title.png" 
				mode="widthFix"
				placeholder="请添加横幅图片"
			></image>
		</view>

		<!-- 商品列表区域 -->
		<view class="products-section">
			<view class="products-list">
				<view 
					class="product-card" 
					v-for="(product, index) in products" 
					:key="index"
				>
					<view class="product-image">
						<image 
							class="product-img" 
							:src="product.imageSrc" 
							mode="aspectFill"
							placeholder="请添加产品图片"
						></image>
						<view class="group-label">
							<text class="group-text">{{ product.groupSize }}人团</text>
						</view>
					</view>
					<view class="product-info">
						<text class="product-title">{{ product.title }}</text>
						<text class="product-desc">{{ product.description }}</text>
						<text class="product-price">¥ {{ product.price }}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				products: [
					{
						title: '腮蓝细腻丝滑元气',
						description: '单色腮红腮紫哑光自然...',
						price: '100.00',
						imageSrc: '/static/groupBuy/img1.png',
						groupSize: 4
					},
					{
						title: '时尚美妆套装',
						description: '多色眼影盘哑光珠光...',
						price: '88.00',
						imageSrc: '',
						groupSize: 3
					},
					{
						title: '护肤精华液',
						description: '补水保湿精华液...',
						price: '120.00',
						imageSrc: '',
						groupSize: 5
					}
				]
			};
		}
	}
</script>

<style lang="scss">
.group-buy {
	position: relative;
	background-color: #f5f5f5;
	min-height: 100vh;
}

.arc-svg {
	position: absolute;
	top: -60px;
	left: 0;
	width: 100%;
	height: 130px;
	z-index: 1;
}

.page-title {
	position: absolute;
	top: -35px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
	font-size: 18px;
	font-weight: bold;
	color: #fff;
}

.promo-banner {
	position: relative;
	z-index: 2;
	padding: 0 16px 30px;
	
	.banner-image {
		width: 100%;
		height: 200px;
		background-color: #f0f0f0;
		border-radius: 12px;
	}
}

.products-section {
	background-color: #fff;
	border-radius: 12px 12px 0 0;
	margin-top: -10px;
	padding: 20px 16px;
	position: relative;
	z-index: 2;
	min-height: 60vh;
}

.products-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.product-card {
	background-color: #fff;
	border: 1px solid #eee;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-image {
	position: relative;
	width: 100%;
	height: 150px;
	background-color: #f0f0f0;
	overflow: hidden;

	.product-img {
		width: 100%;
		height: 100%;
		background-color: #e0e0e0;
	}

	.group-label {
		position: absolute;
		bottom: 6px;
		left: 6px;
		background-color: #ff4757;
		border-radius: 10px;
		padding: 3px 6px;

		.group-text {
			color: #fff;
			font-size: 11px;
			font-weight: bold;
		}
	}
}

.product-info {
	padding: 12px;

	.product-title {
		font-size: 14px;
		color: #333;
		font-weight: bold;
		display: block;
		margin-bottom: 4px;
		line-height: 1.3;
		display: -webkit-box;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.product-desc {
		font-size: 12px;
		color: #666;
		display: block;
		margin-bottom: 8px;
		line-height: 1.3;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.product-price {
		font-size: 16px;
		color: #ff4757;
		font-weight: bold;
	}
}
</style>
